package libs.yzx.zaza;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.ImageView;

/**
 * Created by Administrator on 2016/8/1
 */
public class ActionBarActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_ab);


        android.support.v7.app.ActionBar ab = getSupportActionBar();


        ab.setTitle("");


        ab.setHomeButtonEnabled(true);
        ab.setDisplayShowCustomEnabled(true);

        ab.setDisplayHomeAsUpEnabled(false);
        ab.setDefaultDisplayHomeAsUpEnabled(false);
        ab.setDisplayShowHomeEnabled(false);
        ab.setDisplayShowTitleEnabled(false);

        FrameLayout contentView = new FrameLayout(this);
        contentView.setBackgroundColor(Color.GREEN);
        ab.setCustomView(contentView, new ActionBar.LayoutParams(-1, -1, Gravity.CENTER));

        ImageView backIv = new ImageView(this);
        backIv.setImageResource(R.mipmap.nim_actionbar_dark_back_icon);
        contentView.addView(backIv, new FrameLayout.LayoutParams(3 * 45, 3 * 45, Gravity.LEFT));

    }

}
